import request from './request'

export const getActivities = (params?: any) => 
  request.get('/activities', { params })

export const getActivityDetail = (id: number) => 
  request.get(`/activities/${id}`)

export const registerActivity = (activityId: number) =>
  request.post('/activities/register', { activity_id: activityId }) // 注意路径和参数名

// 关注接口
export const followAnchor = (anchorId: number) =>
  request.post('/follows', { anchorId })

export const unfollowAnchor = (anchorId: number) =>
  request.delete('/follows', { data: { anchorId } })

// 获取我的预约
export const getMyRegistrations = () => {
  return request.get('/activities/my-registrations')
}